#pragma once
#include <cv.h>  
#include <cxcore.h>  
#include "ColorPlane.h"
#include <windows.h>
//#include "ImageGradation.h"
 #include <iostream>  
 using namespace std;  

#define RGB_ 1
#define CMY_ 2
#define XYZ_ 3
#define HSV_ 4
#define YUV_ 5
#define Lab_ 6


class MyImage: public IplImage
{
public:


	MyImage();
	MyImage(int nW, int nH, int nBPP, WORD Channels);
	MyImage(MyImage& Im);
	MyImage::MyImage(IplImage* Im);

	void Create(int nW, int nH, int nBPP, WORD Channels );

	void UpdateFromPlanes();

	MyImage& operator = (MyImage* Im);
	ColorPlane* GetPlane(int i = 0);
	void ConvertCMY();
	void ConvertXYZ();
	void ConvertHSV();
	void ConvertYUV();
	void ConvertLab();
	void ConvertCMY_RGB();
	void ConvertXYZ_RGB();
	void ConvertHSV_RGB();
	void ConvertYUV_RGB();
	void ConvertLab_RGB();

	//double AverageBright();

	//void Neg();
	//void Ln();
	//void Brigth_p();
	//void Brigth_m();
	//void Contrast();
	//void Equalize();
	//void Pow(double power);
	//void Reduction(MyImage& Im);

	//void Convolution(CMask* mask);
	//void Convolution_min(int size);
	//void Convolution_max(int size);
	//void Convolution_med_cross(int size);
	//void Convolution_med_square(int size);
	//void Convolution_med_round(int size);
	void UpdatePlanes();
	~MyImage();

	int format;


protected:

	double f (double t);
	double f_inv (double t);
	void MakePlanes();



	int H_int;
	int W_int;
	ColorPlane* mColourPlane;
	

};